﻿/////////////////////////////////////////////////////////////////
//File: ArticleInfo.cs
//Description: 
//Copyright© 2012 Moliu
//History:
//  2012/5/20 17:06:22    moliu    
/////////////////////////////////////////////////////////////////
using System;
using System.Collections;
using MAF.Common;
using System.Collections.Generic;

namespace My.Blog
{
    /// <summary>
    /// 
    /// </summary>
    [Serializable]
    public class Article : BaseEntity
    {
        private bool _IsNew;
        private string _name;

        /// <summary>
        /// 构造方法
        /// </summary>
        public Article()
        {
            CreatedBy = Guid.Empty;
            ModifiedBy = Guid.Empty;
            CreatedOn = DateTime.Now;
            ModifiedOn = DateTime.Now;
        }

        /// <summary>
        /// 使用此方法来创建新文章，新文章可以避开某些规则检查
        /// </summary>
        /// <returns></returns>
        public static Article NewArticle()
        {
            var art = new Article();
            art._IsNew = true;
            return art;
        }

        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                if (string.IsNullOrWhiteSpace(value))
                    throw new ArgumentException("请填写文章标题");

                _name = value;
            }
        }

        /// <summary>
        /// 内容
        /// </summary>
        public string Content { get; set; }

        /// <summary>
        /// 内容概要
        /// </summary>
        public string Summary { get; set; }

        /// <summary>
        /// 作者
        /// </summary>
        public string Author { get; set; }

        public int VisitedCount { get; set; }
        public int CommentsCount { get; set; }

        public bool IsOriginal { get; set; }
        public bool IsPublished { get; set; }
        public bool IsAllowComment { get; set; }

        #region 方法

        /// <summary>
        /// 获取所属分类
        /// </summary>
        public CategoryInfo GetCategory()
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 获取评论列表
        /// </summary>
        /// <returns></returns>
        public List<Comment> GetComments()
        {
            throw new NotImplementedException();
        }

        #endregion

    }
}